package com.tree.backend.service.impl;

import com.tree.backend.entity.pojo.PartyOrganization;
import com.tree.backend.entity.vo.OrgDistributionData;
import com.tree.backend.mapper.PartyOrganizationMapper;
import com.tree.backend.service.IPartyOrganizationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 党组织基本信息表，记录企业内各级党组织的基本信息 服务实现类
 * </p>
 *
 * @author tree
 * @since 2025-10-15
 */
@Service
@RequiredArgsConstructor
public class PartyOrganizationServiceImpl extends ServiceImpl<PartyOrganizationMapper, PartyOrganization> implements IPartyOrganizationService {
    private final PartyOrganizationMapper partyOrganizationMapper;

    @Override
    public List<OrgDistributionData> distribution() {
        /**
         * SELECT industry_type AS "行业类型名称" ,COUNT(1) AS "行业党组织数量",
         *        sum(party_member_count) AS "行业党员总数" ,sum(employee_count) AS "行业员工总数"
         * from party_organization
         * group by industry_type;
         * */
        return partyOrganizationMapper.distribution();
    }
}
